package adfc2.actions;

import adfc2.core.Creature;
import adfc2.entities.Workshop;

public class EnterWorkshopAction extends InstantAction {

    public final Workshop workshop;

    public EnterWorkshopAction(Creature actor, Workshop workshop) {
        super(actor);
        this.workshop = workshop;
    }

    @Override
    protected boolean perform() {
        assert (actor.getXY() == workshop.getEntranceXY());
        assert (actor.container == null && workshop.worker == null);
        workshop.workerEntered(actor);
        return true;
    }

    @Override
    public String toString() {
        return "EnterWorkshopAction[" + workshop + "@" + workshop.getX() + "," + workshop.getY() + "]";
    }
}
